# %%
import plotly.express as px

df = px.data.iris()
fig = px.density_heatmap(
    df, x="sepal_width", y="sepal_length", marginal_x="rug", marginal_y="histogram"
)
fig.show()

# %%
import plotly.graph_objects as go

fig = go.Figure(
    go.Surface(
        contours={
            "x": {"show": True, "start": 1.5, "end": 2, "size": 0.04, "color": "white"},
            "z": {"show": True, "start": 0.5, "end": 0.8, "size": 0.05},
        },
        x=[1, 2, 3, 4, 5],
        y=[1, 2, 3, 4, 5],
        z=[
            [0, 1, 0, 1, 0],
            [1, 1, 1, 1, 1],
            [0, 1, 1, 1, 0],
            [1, 1, 1, 0, 1],
            [0, 1, 1, 1, 0],
        ],
    )
)
fig.update_layout(
    scene={
        "xaxis": {"nticks": 20},
        "zaxis": {"nticks": 4},
        "camera_eye": {"x": 0, "y": -1, "z": 0.5},
        "aspectratio": {"x": 1, "y": 1, "z": 0.2},
    }
)
fig.show()

# %%
import numpy as np

x = np.random.normal(9, 3, 1000)
y = np.random.normal(9, 3, 1000)
xedges = range(18)
yedges = range(18)
H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges))
with open("test.txt", "w") as f:
    np.savetxt(f, np.array(H, dtype=int), fmt="%d")

# %%
H = H / H.max()
fig = px.imshow(H, color_continuous_scale="gray")
fig.show()

# %%
with open("test.txt", "w") as f:
    np.savetxt(f, np.array(H))

# %%
